﻿using System;
using System.Collections.Generic;

namespace Bpms.Config
{
    /// <summary>
    /// 得到基本配置信息
    /// </summary>
    public class ConfigContext
    {
        #region General Config

        /// <summary>
        /// 得到通用配置信息对象
        /// </summary>
        /// <returns></returns>
        public static GeneralConfigInfo GetGeneralConfigInfo()
        {
            return GeneralConfigFileManager.LoadConfig();
        }

        /// <summary>
        /// 得到Title
        /// </summary>
        public static string GetPageTitle
        {
            get
            {
                return GetGeneralConfigInfo().PageTitle;
            }
        }

        /// <summary>
        /// 得到备份数据库文件路径
        /// </summary>
        public static string GetDatabaseBackupPath
        {
            get
            {
                return GetGeneralConfigInfo().DatabaseBackupPath;
            }
        }

        /// <summary>
        /// 得到当前系统的Web地址
        /// </summary>
        public static string GetSystemUrl
        {
            get
            {
                return GetGeneralConfigInfo().SystemUrl;
            }
        }

        /// <summary>
        /// 得到当前系统的Message Web地址
        /// </summary>
        public static string GetMessageUrl
        {
            get
            {
                return GetGeneralConfigInfo().MessageUrl;
            }
        }


        #endregion

        #region Database Config

        public static DbConfigInfo GetDbConfigInfo()
        {
            return DbConfigFileManager.LoadConfig();
        }

        /// <summary>
        /// 返回数据库连接串
        /// </summary>
        public static string GetDBConnectString
        {
            get
            {
                return GetDbConfigInfo().DbConnectstring;
            }
        }

        /// <summary>
        /// 返回表前缀
        /// </summary>
        public static string GetTablePrefix
        {
            get
            {
                return GetDbConfigInfo().TablePrefix;
            }
        }

        /// <summary>
        /// 返回论坛数据库类型
        /// </summary>
        public static string GetDbType
        {
            get
            {
                return GetDbConfigInfo().DbType;
            }
        }

        #endregion

        #region Email Config
        public static EmailConfigInfo GetEmailConfigInfo()
        {
            return EmailConfigFileManager.LoadConfig();
        }

        /// <summary>
        /// smtp服务器
        /// </summary>
        public static string Smtp
        {
            get
            {
                return GetEmailConfigInfo().Smtp;
            }

        }

        /// <summary>
        /// 端口号
        /// </summary>
        public static int Port
        {
            get
            {
                return GetEmailConfigInfo().Port;
            }
        }

        /// <summary>
        /// 系统Email地址
        /// </summary>
        public static string Sysemail
        {
            get
            {
                return GetEmailConfigInfo().SysEmail;
            }
        }


        /// <summary>
        /// 用户名
        /// </summary>
        public static string Username
        {
            get
            {
                return GetEmailConfigInfo().UserName;
            }
        }

        /// <summary>
        /// 密码
        /// </summary>
        public static string Password
        {
            get
            {
                return GetEmailConfigInfo().Password;
            }
        }

        /// <summary>
        /// 邮件内容
        /// </summary>
        public static string Emailcontent
        {
            get
            {
                return GetEmailConfigInfo().EmailContent;
            }
        }



        /// <summary>
        /// 所运行的命名空间
        /// </summary>
        public static string NameSpace
        {
            get
            {
                return GetEmailConfigInfo().NameSpace;
            }
        }

        /// <summary>
        /// DLL名称
        /// </summary>
        public static string DllFileName
        {
            get
            {
                return GetEmailConfigInfo().DllFileName;
            }
        }
        #endregion
    }
}
